<?php  include VIEWPATH.'common/head.php';  ?>
    <script type="text/javascript">
        var status = '<?php echo $_GET['status'];?>';
        if(status == '-1'){
            alert('fail:<?php echo $_GET['msg'];?>');
        }
        function set_status(id, status){
            if(!confirm("你确认此操作吗？")){
                return false;
            }
            var url = "index.php?c=sys&m=beautify_status";
            var param = {"id":id, "status":status};
            common_ajax(url, param, function(data){
                if(data.errorCode == 0) {
                    window.location.href=  window.location.href;
                    return true;
                }else{
                    alert(data.errorMsg);
                }
            });
        }
    </script>
    <body class="gray-bg">
    <div class="wrapper wrapper-content">
        <div class="add-btn" style="float:right;margin-bottom:5px;">
            <div class="modal fade" id="beautify_edit" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true" style="display: none;">
                <div class="modal-dialog" style="width: 60%;"><div class="modal-content"></div></div>
            </div>
        </div>
        <div class="clearfix"></div>
        <div class="row">
            <div class="col-sm-12">
                <div class="ibox float-e-margins">
                    <div class="ibox-title">
                        <a href="index.php?c=sys&m=beautify_edit" class="btn btn-danger" data-toggle="modal" data-target="#beautify_edit">添加</a>
                        <div class="ibox-tools">
                            <a class="collapse-link">
                                <i class="fa fa-chevron-up"></i>
                            </a>
                            <a class="close-link">
                                <i class="fa fa-times"></i>
                            </a>
                        </div>
                    </div>
                    <div class="ibox-content">
                        <form class="form-horizontal" id="f_form" action="index.php?c=<?php echo $_REQUEST['c'];?>&m=<?php echo $_REQUEST['m'];?>" name="form" method="post">
                            <table class="table table-bordered table-hover">
                                <thead>
                                <tr>
                                    <th></th>
                                    <th>用户类型</th>
                                    <th>周期(开始分钟 - 结束分钟)</th>
                                    <th>点攒数(最小 - 最大)</th>
                                    <th>播放量(最小 - 最大)</th>
                                    <th>状态</th>
                                    <th>添加时间</th>
                                    <th></th>
                                </tr>
                                </thead>
                                <tbody>
                                <?php
                                $userType = array(1=>"注册用户", 2=>"机器人", 3=>"数据导入", 4=>"签约用户");
                                foreach($pList as $p) { ?>
                                    <tr>
                                        <th scope="row">
                                            <input type="checkbox" name="id[]" value="<?php echo $p['id']; ?>" class="checkbox ck" />
                                        </th>
                                        <td><?php echo $userType[$p["user_type"]]; ?></td>
                                        <td nowrap="nowrap"><?php echo $p["start_time"]." - ".$p["end_time"]; ?></td>
                                        <td nowrap="nowrap"><?php echo $p["like_num_min"]." - ".$p["like_num_max"]; ?></td>
                                        <td nowrap="nowrap"><?php echo $p["play_num_min"]." - ".$p["play_num_max"]; ?></td>
                                        <td nowrap="nowrap"><?php echo $p["status"] == 0 ? "未启用" : "启用"; ?></td>
                                        <td nowrap="nowrap"><?php echo date("Y-m-d H:i", $p["add_time"]); ?></td>

                                        <td nowrap="nowrap">
                                            <a href="index.php?c=sys&m=beautify_edit&id=<?php echo $p['id']; ?>" data-toggle="modal" data-target="#beautify_edit">编辑</a>
                                            <?php if($p["status"]){ ?>
                                                <a href="javascript:void(0)" onclick="set_status(<?php echo $p['id']; ?>, 0)">停用</a>
                                            <?php }else{ ?>
                                                <a href="javascript:void(0)" onclick="set_status(<?php echo $p['id']; ?>, 1)">启用</a>
                                            <?php } ?>
                                        </td>
                                    </tr>
                                <?php }?>
                                </tbody>
                            </table>
                            <div class="set_page">
                                <?php echo $multipage;?>
                                <div class="set_del">
                                    <label class="l_c_sel">
                                        <input type="checkbox" name="chkall" onclick="checkAll('prefix', this.form, 'id')" class="checkbox c_sel" style="float: left;margin: 0px;display: inline;"/>全选
                                    </label>
                                </div>
                                <div class="clearfix"></div>
                            </div>
                        </form>
                    </div>
                </div>
            </div>
        </div>

    </div>


<?php  include VIEWPATH.'common/footer.php';  ?>